home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / X11R4 / cmds / X / os / sprite / RCS / spriteos.h,v < prev    next >
Encoding:
Text File  |  1990-03-16  |  11.9 KB  |  498 lines

  1. head     1.12;
  2. branch   ;
  3. access   ;
  4. symbols  ;
  5. locks    ; strict;
  6. comment  @ * @;
  7.  
  8.  
  9. 1.12
  10. date     89.10.04.19.18.15;  author tve;  state Exp;
  11. branches ;
  12. next     1.11;
  13.  
  14. 1.11
  15. date     88.09.08.18.15.43;  author ouster;  state Exp;
  16. branches ;
  17. next     1.10;
  18.  
  19. 1.10
  20. date     88.08.26.16.13.39;  author brent;  state Exp;
  21. branches ;
  22. next     1.9;
  23.  
  24. 1.9
  25. date     88.08.26.15.51.32;  author deboor;  state Exp;
  26. branches ;
  27. next     1.8;
  28.  
  29. 1.8
  30. date     87.11.29.19.52.27;  author deboor;  state Exp;
  31. branches ;
  32. next     1.7;
  33.  
  34. 1.7
  35. date     87.11.01.20.22.51;  author deboor;  state Exp;
  36. branches ;
  37. next     1.6;
  38.  
  39. 1.6
  40. date     87.08.21.20.31.27;  author deboor;  state Exp;
  41. branches ;
  42. next     1.5;
  43.  
  44. 1.5
  45. date     87.06.30.19.11.25;  author deboor;  state Exp;
  46. branches ;
  47. next     1.4;
  48.  
  49. 1.4
  50. date     87.06.23.13.30.04;  author deboor;  state Exp;
  51. branches ;
  52. next     1.3;
  53.  
  54. 1.3
  55. date     87.06.20.19.58.21;  author deboor;  state Exp;
  56. branches ;
  57. next     1.2;
  58.  
  59. 1.2
  60. date     87.06.13.11.27.29;  author deboor;  state Exp;
  61. branches ;
  62. next     1.1;
  63.  
  64. 1.1
  65. date     87.06.11.17.47.24;  author deboor;  state Exp;
  66. branches ;
  67. next     ;
  68.  
  69.  
  70. desc
  71. @header file for the sprite OS layer
  72. @
  73.  
  74.  
  75. 1.12
  76. log
  77. @changed from lst library to list library
  78. @
  79. text
  80. @/*-
  81.  * spriteos.h --
  82.  *    Internal data for Sprite OS layer.
  83.  *
  84.  * Copyright (c) 1987 by the Regents of the University of California
  85.  *
  86.  * Permission to use, copy, modify, and distribute this
  87.  * software and its documentation for any purpose and without
  88.  * fee is hereby granted, provided that the above copyright
  89.  * notice appear in all copies.  The University of California
  90.  * makes no representations about the suitability of this
  91.  * software for any purpose.  It is provided "as is" without
  92.  * express or implied warranty.
  93.  *
  94.  *    "$Header: spriteos.h,v 1.11 88/09/08 18:15:43 ouster Exp $ SPRITE (Berkeley)"
  95.  */
  96. #ifndef _OS_H
  97. #define _OS_H
  98.  
  99. /*
  100.  * Because both Sprite and X define the type 'Time' (and they're incompatible),
  101.  * we have to kludge things by making the definition of Time in the Sprite
  102.  * files be SpriteTime. Henceforth, that is what the Sprite Time value should
  103.  * be referred to as.
  104.  */
  105. #include    "buf.h"
  106. #include    <list.h>
  107.  
  108. #include    "X.h"
  109. #include    "Xmd.h"
  110. #include    "os.h"
  111. #include    "dixstruct.h"
  112.  
  113. /*
  114.  * Scheduling interval. After MAX_PACKETS requests have been processed,
  115.  * the client is forced to yield the server to the next client.
  116.  */
  117. #define MAX_PACKETS    10
  118.  
  119. /*
  120.  * Various aspects of a client must be tracked to handle the protocol.
  121.  * These are stored in the ClntPrivRec hanging from the osPrivate field of
  122.  * the ClientRec.
  123.  *
  124.  * There are two distinct types of connections being used here. One is
  125.  * over a Pseudo-device where the connection is very synchronous. The
  126.  * other is over a TCP stream, as managed by the TCP module. There are
  127.  * various differences between the two, not the least of which that there
  128.  * is only one stream for the TCP connection. To embody this, each client
  129.  * has a Read and a Write function, as well as a stream-private pointer
  130.  * that is manipulated only by the controlling module. To determine when
  131.  * a client is ready, two select masks are also maintained.
  132.  */
  133. typedef struct {
  134.     char          *(*readProc)();   /* Function to read from the client */
  135.     int              (*writeProc)();   /* Function to write to the client */
  136.     void          (*closeProc)();   /* Function to close down the client */
  137.  
  138.     int              *mask;        /* Mask of all streams for this client
  139.                      * (set by the controlling module) */
  140.     int              *ready;        /* Mask of streams that are ready
  141.                      * (set by the scheduler) */
  142.     int              maskWidth;          /* Width of said masks */
  143.     pointer       devicePrivate;    /* Data private to the controlling module */
  144. } ClntPrivRec, *ClntPrivPtr;
  145.  
  146. /*
  147.  * Global data
  148.  */
  149. extern int            *AllClientsMask;        /* All active clients */
  150. extern int            *SavedAllClientsMask;   /* When grabbed */
  151. extern int            *AllStreamsMask;      /* All streams to check */
  152. extern int            *SavedAllStreamsMask;   /* When grabbed */
  153. extern int            *LastSelectMask;    /* Result of Fs_Select */
  154. extern int            *EnabledDevicesMask;    /* Mask from devices */
  155. extern int            *ClientsWithInputMask;  /* Mask of clients with input
  156.                              * still in their buffers */
  157. extern int            NumActiveStreams;       /* The number of active streams
  158.                          * used in the various bit
  159.                          * masks */
  160. #ifdef TCPCONN
  161. extern int            TCP_Conn;               /* TCP listening socket */
  162. #endif TCPCONN
  163.  
  164. extern int            Pdev_Conn;            /* New Pseudo-device control
  165.                          * stream ID */
  166.  
  167. extern char           *display;            /* Our display number */
  168. extern Bool           GrabDone;               /* TRUE if listening to only
  169.                          * one client */
  170. extern ClientPtr      grabbingClient;       /* Client that performed the
  171.                          * grab. */
  172. extern char           whichByteIsFirst;       /* Our byte order */
  173. extern List_Links    allStreams;             /* All open streams */
  174. extern int            spriteCheckInput;
  175. extern void           spriteInputAvail();
  176. extern void           ExpandMasks();
  177. extern Bool           clientsDoomed;
  178. /*
  179.  * Debug control:
  180.  *    There is one bit per module. It is up to the module what debug
  181.  *    information to print.
  182.  *    DBG(module) returns TRUE if debugging is on for that module.
  183.  */
  184. extern int            debug;
  185. #define DEBUG_SCHED    0x00000001
  186. #define DEBUG_CONN    0x00000002
  187. #define DEBUG_PDEV     0x00000004
  188. #define DEBUG_TCP     0x00000010
  189.  
  190. #define I(a)          a
  191. #ifdef __STDC__
  192. #define CONCAT(a,b)    a##b
  193. #else
  194. #define CONCAT(a,b)    I(a)b
  195. #endif /* __STDC__ */
  196. #define DBG(module)    (debug & CONCAT(DEBUG_,module))
  197.  
  198. #define FamilySprite    3       /* Pseudo-device access control -- should
  199.                  * be in X.h */
  200.  
  201. #endif _OS_H
  202. @
  203.  
  204.  
  205. 1.11
  206. log
  207. @Intermediate check-in while converting to new C library.
  208. @
  209. text
  210. @d15 1
  211. a15 1
  212.  *    "$Header: spriteos.h,v 1.10 88/08/26 16:13:39 brent Exp $ SPRITE (Berkeley)"
  213. d27 1
  214. a27 1
  215. #include    "lst.h"
  216. d94 1
  217. a94 1
  218. extern Lst            allStreams;             /* All open streams */
  219. @
  220.  
  221.  
  222. 1.10
  223. log
  224. @Nuked use of NEWPDEV
  225. @
  226. text
  227. @d15 1
  228. a15 1
  229.  *    "$Header: spriteos.h,v 1.8 87/11/29 19:52:27 deboor Exp $ SPRITE (Berkeley)"
  230. a25 8
  231. #define Time      SpriteTime
  232.  
  233. #include    <sprite.h>
  234. #include    <fs.h>
  235. #include    <io.h>
  236. #include    <bit.h>
  237. #include    <mem.h>
  238.  
  239. a27 1
  240. #undef Time
  241. @
  242.  
  243.  
  244. 1.9
  245. log
  246. @Added __STC__ stuff and OLDPDEV defines
  247. @
  248. text
  249. @a89 4
  250. #ifdef OLDPDEV
  251. extern int            Pdev_Conn;               /* Pseudo device control
  252.                          * stream ID */
  253. #endif OLDPDEV
  254. d93 2
  255. a94 2
  256. #ifdef NEWPDEV
  257. extern int            NewPdev_Conn;            /* New Pseudo-device control
  258. a95 1
  259. #endif NEWPDEV
  260. a117 1
  261. #define DEBUG_NEWPDEV    0x00000008
  262. @
  263.  
  264.  
  265. 1.8
  266. log
  267. @Added support for conditional debugging
  268. @
  269. text
  270. @d15 1
  271. a15 1
  272.  *    "$Header: spriteos.h,v 1.7 87/11/01 20:22:51 deboor Exp $ SPRITE (Berkeley)"
  273. d90 1
  274. d93 1
  275. d127 3
  276. d131 1
  277. d133 3
  278. @
  279.  
  280.  
  281. 1.7
  282. log
  283. @Removed pseudo-device dependencies to pdev.c and generalised
  284. private data, as well as added support for TCP connections
  285. @
  286. text
  287. @d15 1
  288. a15 1
  289.  *    "$Header: spriteos.h,v 1.6 87/08/21 20:31:27 deboor Exp $ SPRITE (Berkeley)"
  290. d95 4
  291. d111 17
  292. @
  293.  
  294.  
  295. 1.6
  296. log
  297. @Adapted to single-output-buffer changes in clientIO.c
  298. @
  299. text
  300. @d15 1
  301. a15 1
  302.  *    "$Header: spriteos.h,v 1.5 87/06/30 19:11:25 deboor Exp $ SPRITE (Berkeley)"
  303. a30 1
  304. #include    <dev/pdev.h>
  305. d50 12
  306. a61 8
  307.  * A client can be made up of multiple streams (if the client is multi-
  308.  * threaded, e.g.), so we have to track each one separately. They are
  309.  * all kept under the same ClntPrivRec. When an event is to be sent to
  310.  * the client, it is written to all the streams. When a request comes in,
  311.  * its sequence number is remembered in the lastSeq field (we have to look
  312.  * at the DIX Client structure to do this, but it can't be helped). When a
  313.  * reply or error is generated, it is routed to the correct stream by
  314.  * examining its sequence number.
  315. d64 3
  316. a66 5
  317.     ClientPtr            client;     /* Client this stream is for
  318.                      * (backward link for closings) */
  319.     int                  clientFlags;/* Flags from client's Fs_Open */
  320.     int                  pdevID;        /* ID gotten from original pdev open */ 
  321.     int                  streamID;   /* The stream used */
  322. d68 6
  323. a73 34
  324.     /*
  325.      * Output things
  326.      */
  327.     Boolean           waiting;    /* The client is waiting */
  328.     Pdev_WaitInfo    wait;        /* Thing with which to wake the client up*/
  329.     enum {
  330.     SELECT, READ
  331.     }                  whyWait;    /* Why the client is waiting... */
  332.  
  333.     /*
  334.      * Input things
  335.      */
  336.     Address           buffer;        /* A buffer for reading from the client */
  337.     Address           bufPtr;        /* The current offset into the buffer */
  338.     int                  numBytes;   /* The number of bytes remaining in the
  339.                      * buffer */
  340.     Boolean           needData;   /* TRUE if not enough data in buffer
  341.                      * to fulfill the request in there */
  342. } ClntStreamRec, *ClntStreamPtr;
  343.  
  344. /*
  345.  * Various aspects of a client must be tracked to handle the pseudo-device
  346.  * protocol. These are stored in the ClntPrivRec hanging from the osPrivate
  347.  * field of the ClientRec.
  348.  */
  349. typedef struct {
  350.     int                  *mask;        /* Mask of all streams for this client */
  351.     int                  *ready;        /* Mask of streams which are ready */
  352.     int                  maskWidth;  /* Width of said masks */
  353.     Buffer            outBuf;     /* Packets awating a read request from
  354.                      * the client processes. */
  355.     Lst                  streams;    /* All open streams for this client */
  356.     LstNode           lastStream; /* The last stream serviced. Used for
  357.                      * scheduling */
  358. d90 1
  359. a90 1
  360. extern int            PseudoDevice;       /* Pseudo device control
  361. d92 4
  362. d105 2
  363. @
  364.  
  365.  
  366. 1.5
  367. log
  368. @Adapted to beta-1
  369. @
  370. text
  371. @d15 1
  372. a15 1
  373.  *    "$Header: spriteos.h,v 1.4 87/06/23 13:30:04 deboor Exp $ SPRITE (Berkeley)"
  374. a69 2
  375.     Buffer            outBuf;     /* Packets awating a read request from
  376.                      * the client. */
  377. d96 2
  378. d99 2
  379. a100 3
  380.     LstNode           lastStream; /* The last stream serviced. Used both for
  381.                      * scheduling and to pass out errors and
  382.                      * replies */
  383. @
  384.  
  385.  
  386. 1.4
  387. log
  388. @Added use of Buf library
  389. @
  390. text
  391. @d15 1
  392. a15 1
  393.  *    "$Header: spriteos.h,v 1.3 87/06/20 19:58:21 deboor Exp $ SPRITE (Berkeley)"
  394. d42 1
  395. d61 1
  396. a61 1
  397.     int                  clientID;   /* Client number this stream is for
  398. d64 1
  399. d73 1
  400. a73 1
  401.     Fs_PdevWaitInfo    wait;        /* Thing with which to wake the client up*/
  402. d91 2
  403. a92 3
  404.  * protocol. These are stored in the ClntPrivRec in the clientPriv array.
  405.  * It ought to be hanging from the osPrivate field of the ClientRec, but
  406.  * the ClientRec isn't allocated when the connection is established, so...
  407. a101 3
  408.     Bool              clientNew;  /* TRUE if the client is new. i.e. we
  409.                      * have received no requests from it --
  410.                      * used mostly in WriteToClient */
  411. a114 4
  412.  
  413. extern int            FirstClient;            /* First real client */
  414. extern int            LastClient;            /* Last client allocated */
  415.  
  416. a119 1
  417.  
  418. a120 1
  419.  
  420. d123 2
  421. a124 3
  422. extern int            grabbingClientID;       /* ID number of client which
  423.                          * performed the grab. */
  424.  
  425. d126 1
  426. a126 4
  427. extern ClntPrivRec    clientPriv[];
  428. extern int            *StreamToClient;        /* Mapping from streamID to
  429.                          * clientID */
  430.  
  431. a128 1
  432. extern void           sunInputAvail();
  433. @
  434.  
  435.  
  436. 1.3
  437. log
  438. @adapted to Beta-0 and "debugged"
  439. @
  440. text
  441. @d15 1
  442. a15 1
  443.  *    "$Header: spriteos.h,v 1.2 87/06/13 11:27:29 deboor Exp $ SPRITE (Berkeley)"
  444. d35 1
  445. d68 2
  446. a69 4
  447.     Lst                  outPackets; /* Packets awaiting a read request from the
  448.                      * client */
  449.     int                  lenPackets; /* The length of all the packets */
  450.  
  451. @
  452.  
  453.  
  454. 1.2
  455. log
  456. @Adapted to new method of accessing the pseudo-device in
  457. clientIO.c
  458. @
  459. text
  460. @d15 1
  461. a15 1
  462.  *    "$Header: spriteos.h,v 1.1 87/06/11 17:47:24 deboor Exp $ SPRITE (Berkeley)"
  463. d31 1
  464. a31 1
  465. #include    <kernel/fsPdev.h>
  466. d72 4
  467. a75 1
  468.     Fs_PdevWaitInfo    wait;        /* Thing with which to wake the client up */
  469. d84 2
  470. d102 3
  471. @
  472.  
  473.  
  474. 1.1
  475. log
  476. @Initial revision
  477. @
  478. text
  479. @d15 1
  480. a15 1
  481.  *    "$Header$ SPRITE (Berkeley)"
  482. d33 1
  483. d35 1
  484. a58 1
  485.     Bool              active;        /* TRUE if connection active */
  486. d63 18
  487. a80 3
  488.     Io_Stream            inStream;   /* Input buffer. Only one request is read
  489.                      * into the buffer at once */
  490.     Io_Stream            outStream;  /* Buffered output awaiting read call */
  491. d92 3
  492. a94 4
  493.     int                  maskWidth;  /* Width of said mask */
  494.     int                  numStreams; /* Number of streams for this client */
  495.     ClntStreamPtr      streams;    /* All streams for this client */
  496.     ClntStreamPtr     lastStream; /* The last stream serviced. Used both for
  497. @
  498.